import React from 'react'
import store from '../../redux/store'
import {  allAction, allAsyncActiong } from '../../redux/reducers/countReducer'

export default function StateUpdate() {
  return (
    <>
    <button onClick={() => {
        //更新状态
        store.dispatch(allAction('add',66))
        //获取状态
        // console.log(store.getState());
      }}>新增</button>
      <button onClick={() => {
        store.dispatch(allAction('sub',3))
      }}>减少</button>
      <button onClick={()=>{
        store.dispatch(allAction('chen',18))
      }}>相乘</button>
      <button onClick={()=>{
        store.dispatch({type:'chu',payload:9})
      }}>相除</button>
      <button onClick={()=>{
        store.dispatch(allAsyncActiong('add',66))
      }}>一秒之后加</button>
    </>
  )
}
